#include <cstdio>
#include <iostream>
#define MAX_N 100005
using namespace std;

int fa[MAX_N];
int rnk[MAX_N];

int __find(int x)
{
    int rt = x;
    if  (x != fa[x])
    {
        rt = __find(fa[x]);
        rnk[x] = rnk[x] ^ rnk[fa[x]];
        fa[x] = rt;
    }
    return rt;
}

void __union(int x, int y)
{
    int ta = __find(x);
    int tb = __find(y);
    rnk[ta] = ~(rnk[x] ^ rnk[y]);
    fa[ta] = tb;
}

int main()
{
    int T;
    cin >>T;
    char q[3];
    int a,b,ta,tb;
    int n , m , i;
    while (T--)
    {
        cin >>n >>m;
        for (i = 1;  i<= n; i++)
        {
            fa[i] = i;
            rnk[i] = 0;
        }
        while (m--)
        {
            scanf("%s%d%d",q,&a,&b);
            if (q[0]=='D')
            {
                __union(a,b);
            }
            else
            {
                ta = __find(a);
                tb = __find(b);
                if (ta!=tb) printf("Not sure yet.\n");
                else if (rnk[a] == rnk[b]) printf("In the same gang.\n");
                else printf("In different gangs.\n");
            }
        }
    }
    return 0;
}
